<template>
  <div>
    <div class="test">
      <van-grid :column-num="6">
        <van-grid-item @click="component(item.name)" icon="gem-o" :text="item.text" v-for="(item,index) in components" :key="index"/>
      </van-grid>
      <component :receive='receive' :is="currentView"/>
    </div>
  </div>
</template>

<script>
import Calendar from './calendar'
import Uploader from './uploader'
import Relation from './relation'
  export default {
    props: ['id'],
    created(){
    },
    data() {
      return {
        currentView: 'Calendar',
        components: [
          {name: 'Calendar',text: '日历'},
          {name: 'Uploader',text: '上传'},
          {name: 'Relation',text: '图谱'},
        ]
      }
    },
    components: {
      Calendar,Uploader,Relation
    },
    methods: {
      component(val) {
        this.currentView = val
      },
      receive(x) {
        console.log('我是父组件',x)
      }
    }
  }
</script>  
<style lang="less" scoped>

</style>